import json

from config import BASE_DIR


def read_tpshopLogin():
    with open(BASE_DIR + '/data/Tpshop_login_data.json', 'r', encoding='utf-8') as f:
        data = json.load(f)
        tpshopLogin_list = []
        for i in data:
            tpshopLogin_list.append((i["username"], i["password"], i["verify_code"], i["data"]["state_code"],
                                     i["data"]["code"], i["data"]["msg"]))
        return tpshopLogin_list


def read_tpshopRegister():
    with open(BASE_DIR + '/data/Tpshop_register_data.json', 'r', encoding='utf-8') as f:
        data = json.load(f)
        tpshopRegister_list = []
        for i in data:
            tpshopRegister_list.append(
                (i["username"], i["verify_code"], i["password"], i["password2"], i["data"]["status_code"],
                 i["data"]["status"], i["data"]["msg"]))
        return tpshopRegister_list


def read_ihrmLogin():
    with open(BASE_DIR + '/data/Ihrm_login_data.json', 'r', encoding='utf-8') as f:
        data = json.load(f)
        ihrmLogin_list = []
        for i in data:
            ihrmLogin_list.append((i["mobile"], i["password"], i["data"]["state_code"], i["data"]["success"],
                                   i["data"]["code"], i["data"]["message"]))
        return ihrmLogin_list


def read_ihrmAdd():
    with open(BASE_DIR + '/data/Ihrm_add_data.json', 'r', encoding='utf-8') as f:
        data = json.load(f)
        ihrmAdd_list = []
        for i in data:
            ihrmAdd_list.append(
                (i["username"], i["mobile"], i["workNumber"], i["data"]["state_code"], i["data"]["success"],
                 i["data"]["code"], i["data"]["message"]))
        return ihrmAdd_list


def read_ihrmSearch():
    with open(BASE_DIR + '/data/Ihrm_search_data.json', 'r', encoding='utf-8') as f:
        data = json.load(f)
        ihrmSearch_list = []
        for i in data:
            ihrmSearch_list.append(
                (i["emp_id"], i["data"]["state_code"], i["data"]["success"],
                 i["data"]["code"], i["data"]["message"]))
        return ihrmSearch_list


def read_ihrmUpdate():
    with open(BASE_DIR + '/data/Ihrm_update_data.json', 'r', encoding='utf-8') as f:
        data = json.load(f)
        ihrmUpdate_list = []
        for i in data:
            ihrmUpdate_list.append(
                (i["emp_id"], i["username"], i["data"]["state_code"], i["data"]["success"],
                 i["data"]["code"], i["data"]["message"]))
        return ihrmUpdate_list


def read_ihrmDelete():
    with open(BASE_DIR + '/data/Ihrm_delete_data.json', 'r', encoding='utf-8') as f:
        data = json.load(f)
        ihrmDelete_list = []
        for i in data:
            ihrmDelete_list.append(
                (i["emp_id"], i["data"]["state_code"], i["data"]["success"],
                 i["data"]["code"], i["data"]["message"]))
        return ihrmDelete_list

def read_zy():
    with open(BASE_DIR + '/data/test.json', 'r', encoding='utf-8') as f:
        data = json.load(f)
        list1 = []
        for i in data:
            list1.append((i["a"], i["b"],i["c"]))
        return list1

if __name__ == '__main__':
    # print(read_tpshopLogin())
    # print(read_ihrmLogin())
    # print(read_ihrmAdd())
    # print(read_ihrmSearch())
    # print(read_ihrmUpdate())
    # print(read_ihrmDelete())
    # print(read_tpshopRegister())
    print(read_zy())